<?php
	require_once('Connections/conexao.php'); 

	$id = $_SESSION['id'];

	mysql_select_db($database_conexao, $conexao);	
	$queryNot = "SELECT * FROM inbox WHERE id_usuario = '$id'";
	$Not = mysql_query($queryNot, $conexao) or die(mysql_error());
	$rowNot = mysql_fetch_assoc($Not);
	$totalRowsNot = mysql_num_rows($Not);
	
	mysql_select_db($database_conexao, $conexao);	
	$queryNot = "SELECT n.titulo, n.id FROM noticias n, inbox i WHERE n.id = i.id_noticia AND i.id_usuario = '$id'";
	$Not = mysql_query($queryNot, $conexao) or die(mysql_error());
	$rowNot = mysql_fetch_assoc($Not);
	$totalRowsNot = mysql_num_rows($Not);		
?>

<div id="safe-cadastrar">
<h1>Conta no Bagulho</h1>
<hr />

<!-- LADO ESQUERDO -->
<div id="cad-left">
   	<a href="?pg=perfil"><h2>Dados Pessoais</h2></a>    
   	<a href="?pg=acesso"><h2>Alterar Senha</h2></a>
    <a href="?pg=inbox"><h2 class="cad-select">Inbox</h2></a>
</div>


<!-- LADO DIREITO -->
<div id="cad-right">
	<h2 class="cad-title" style="width:200px;">Minhas Notícias</h2>
    <hr />
    
    <div id="qtde-inbox"><?php echo $totalRowsNot; ?> notícias salvas</div>
    
    <div id="safe-inbox">
    	<?php do { ?>
    	<div id="box">
        	<div id="box-title"><a href="?pg=noticia&id=<?php echo $rowNot['id']; ?>" title="Ler notícia completa"><?php echo $rowNot['titulo']; ?></a></div>
        </div>
        <?php } while ($rowNot = mysql_fetch_assoc($Not)); ?>
    </div>
    
</div>

</div>